This document is for the analysis of data collected in Southeast Alaska to assess variation in food web structure in streams across a gradient of hydrologic and physio-chemical conditions. This is a workind document and will be backed up on github at the following location: https://github.com/mdunkle/SEAK-Analysis.git
Plotting the length/weight relationship for Coho, Cutthroat, and DVs at the MT/McginConf
Here I’m visualizing lengths by species and reach
Next, I’m visualizing just the Dolly Varden data and showing the distribution as boxplots.
Next, I’m visualizing just the Dolly Varden data and showing the distribution as a boxplots.
Here, I’m using density ridge plots to show the distribution of lengths of each species by the two sampling events. The second plot shows the same data, but bracketed by stream type (glacial, clearwater (cw), brownwater (bw), and a combination of two (e.g. (CW/BW)) or all three (combined)). These distinctions are somewhat arbitrary, as most systems in SEAK show a combination of all three stream types and no one system is purely one type. It may be more useful to represent each of these as bins of conditions along a gradient of turbidity, flow variability, or DOC concentration.
cohodv=ggplot(subset(SEAK, Species==c("DollyVarden","Coho")), aes(x=Length, y=StreamID, fill=Species))+
geom_density_ridges(alpha=.5,scale=1,size=.00001, rel_min_height=0)+
theme_ridges()
cohodv
Here, I load the data for catch per unit effort stored in the file SEAK_CPUE.csv. The associated figure shows the average catch across sites within a stream system during July and September sampling with an arrow showing the trend in catch rate between the two events. Important to note, Peterson Creek had the highest catch rate (and likely density) of any site in July and almost no juvnile salmonids in September. This could be due to hypoxic conditions or disturbance caused by adult salmon spawning in high densities in this system.
In this section, I visualize and analyze the data from periphyton samples taken during the 2017 pilot study.
UAS Data from Jason Fellman showing the variables measured in 2006-2007.
## `geom_smooth()` using method = 'loess'
## Warning: Removed 7 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using method = 'loess'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using method = 'loess'
## Warning: Removed 15 rows containing non-finite values (stat_smooth).
This was a practice for extracting data from Stella simulations and plotting in ggplot.
Here I’m doing some spatial work to make sampling location maps. For some reason, this code is no longer working and needs some attention.
library(“tmaptools”) library(“sf”) library(“leaflet”) library(“rio”) library(“maptools”)
wbdhu14 = “WBDHU14.shp” wbdhu14geo=read_shape(file=wbdhu14, as.sf=T) qtm(wbdhu14geo)
wbdhu8 = “WBDHU8.shp” wbdhu8geo = read_shape(file=wbdhu8, as.sf=T) qtm(wbdhu8geo)
wbdhu12 = “WBDHU12.shp” wbdhu12geo = read_shape(file=wbdhu12, as.sf=T) qtm(wbdhu12geo, “NAME” )
wbdhu10=“WBDHU10.shp” wbdhu10geo=read_shape(file=wbdhu10, as.sf = T) qtm(wbdhu10geo)
nhdflowline=“NHDFlowline.shp” nhdflowlinegeo=read_shape(file=nhdflowline, as.sf=T) qtm(nhdflowlinegeo)
alaskacoastline=“alaska_63360_py.shp” alaskacoastlinegeo=read_shape(file=alaskacoastline) pcreek=“Peterson Creek” wbdhu14geo=cbind(pcreek, wbdhu14geo) seakpoints=“SEAK-Sampling-Locations.shp” seakpointsgeo=read_shape(file=seakpoints) juneauwater=“tl_2015_02110_areawater.shp” juneauwatergeo=read_shape(file=juneauwater) head(juneauwatergeo, 50) mendenhallglacier=subset(juneauwatergeo, FULLNAME==“Mendenhall Glacier”) juneauicefield=subset(juneauwatergeo, FULLNAME==“Juneau Icefield”) akglaciers = “01_rgi60_Alaska.shp” akglaciersgeo=read_shape(file=akglaciers)
tm=tm_shape(wbdhu12geo, ylim=c(58.35, 58.55), xlim=c(-134.8, -134.38))+ tm_fill(“white”)+tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Lynn Canal”,])+tm_fill(“gray20”)+ #tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Eagle River”,])+tm_fill(“white”, lwd=2)+tm_text(text=“NAME”)+tm_borders(“black”)+ # tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Herbert Glacier”,])+tm_fill(“white”, lwd=2)+tm_borders(“black”)+ #tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Mendenhall Glacier”,])+tm_fill(“white”, lwd=2)+tm_borders(“black”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Fritz Cove-Frontal Lynn Canal”,])+tm_fill(“gray20”, lwd=2)+tm_borders(“gray20”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Tee Creek-Frontal Lynn Canal”,])+tm_fill(“gray20”, lwd=2)+tm_borders(“gray20”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“19010301060612-Mendenhall Peninsula”,])+tm_fill(“gray20”, lwd=2)+ tm_shape(alaskacoastlinegeo)+tm_fill(“white”)+ tm_shape(juneauicefield)+tm_fill(“dodgerblue”)+#tm_text(“FULLNAME”)+ tm_shape(mendenhallglacier)+tm_fill(“dodgerblue”)+#tm_text(“FULLNAME”)+ tm_shape(akglaciersgeo)+tm_fill(col=“dodgerblue”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Mendenhall River”,])+tm_fill(“gray”, lwd=2, alpha=.5)+tm_text(text=“NAME”, xmod=6, ymod=4)+tm_borders(“black”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Steep Creek”,])+tm_fill(“gray”, lwd=2, alpha=.5)+tm_text(text=“NAME”, xmod=3, ymod=2)+tm_borders(“black”)+ tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Herbert River”,])+tm_fill(“gray”, lwd=2, alpha=.5)+tm_text(text=“NAME”)+tm_borders(“black”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Peterson Lake-Peterson Creek”,])+tm_fill(“gray”, lwd=2, alpha=.5)+tm_text(text=“pcreek”, xmod=1, ymod=-1)+tm_borders(“black”)+ tm_shape(wbdhu12geo[wbdhu12geo$NAME==“Montana Creek”,])+tm_fill(“gray”, lwd=2, alpha=.5)+tm_text(text=“NAME”, xmod=0,ymod=-6)+tm_borders(“black”)+ #tm_shape(wbdhu14geo[wbdhu14geo$NAME==“Windfall Creek”,])+tm_fill(“white”,lwd=2)+tm_text(text=“NAME”)+tm_borders(“black”)+ tm_shape(wbdhu14geo[wbdhu14geo$NAME==“McGinnis Creek”,])+tm_fill(“gray”,lwd=2, alpha=.0)+tm_text(text=“NAME”, xmod=7.5, ymod=2)+tm_borders(“black”)+ #tm_grid(projection=“longlat”, labels.size=.5, alpha=.75)+ tm_shape(nhdflowlinegeo)+tm_lines(“black”, alpha=.5)+ tm_shape(seakpointsgeo)+tm_symbols(col=“black”)+ tm_scale_bar()+tm_style_classic() tm
# function to obtain US county shape get_US_county_2010_shape <- function() { dir <- tempdir() download.file(“http://www2.census.gov/geo/tiger/GENZ2010/gz_2010_us_050_00_20m.zip”, destfile = file.path(dir, “gz_2010_us_050_00_20m.zip”)) unzip(file.path(dir, “gz_2010_us_050_00_20m.zip”), exdir = dir) read_shape(file.path(dir, “gz_2010_us_050_00_20m.shp”)) }
US <- get_US_county_2010_shape()
US_cont <- US[!(US$STATE %in% c(“02”,“15”,“72”)),]
US_AK <- US[US$STATE == “02”, ] US_HI <- US[US$STATE == “15”,]
US_states <- unionSpatialPolygons(US_cont, IDs=US_cont$STATE) tmap_mode(“plot”)
m_AK <- tm_shape(US_AK, projection = 3338) + tm_polygons(border.col = “grey50”, border.alpha = .5, breaks = seq(10, 50, by = 5)) + tm_layout(“Alaska”, legend.show = FALSE, bg.color = NA, title.size = 0.8, frame = FALSE) print(m_AK, vp=viewport(x= 0.15, y= 0.15, width= 0.3, height= 0.3)) ```